package ie.lawlor.amvc;

/**
 * @author brendan
 */
public class ChildTriad {

	private Triad child;
	private ViewContainer viewContainer;
	
	/**
	 * @return Returns the child.
	 */
	public Triad getChild() {
		return child;
	}
	/**
	 * @param child The child to set.
	 */
	public void setChild(Triad child) {
		this.child = child;
	}
	/**
	 * @return Returns the parentView.
	 */
	public ViewContainer getViewContainer() {
		return viewContainer;
	}
	/**
	 * @param parentView The parentView to set.
	 */
	public void setViewContainer(ViewContainer parentView) {
		this.viewContainer = parentView;
	}
	
	public void setViewName(String name){
		this.viewContainer = new ViewContainer();
		viewContainer.setName(name);
	}
	
	public String getViewName(){
		return viewContainer.getName();
	}
	
	public String getViewContainerName(){
		if (viewContainer != null){
			return viewContainer.getName();
		} else {
			return null;
		}
	}
	
	public void addTo(Triad triad){
		triad.addChild(child, getViewContainerName());
	}
	
}
